﻿using B.S.DataBase.MyProject.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using T.E.ERP.Write.API.Applicantions.Command.MaterialsCommand.MaterialsCommand;

namespace T.E.ERP.Write.API.Controllers
{
    /// <summary>
    /// 物料管理-写
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class MaterialsController : ControllerBase
    {
        /// <summary>
        /// 中介者
        /// </summary>
        private readonly IMediator mediator;
        /// <summary>
        /// 构造方法
        /// </summary>
        /// <param name="mediator"></param>
        public MaterialsController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 物料分类增加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddMaterialCategory(MaterialCategoryAddCommand command)
        {
            return await mediator.Send(command);
        }

        /// <summary>
        /// 物料基本档增加
        /// </summary>
        /// <param name="command"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<APIResult<object>> AddMaterial_Basic(Material_BasicAddCommand command)
        {
            return await mediator.Send(command);
        }




    }
}
